﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Caifu.Datas;

namespace Caifu.Clients
{
	/// <summary>
	/// 基金管理人操作类。
	/// </summary>
	public static class InvestAdvisorClient
	{
		/// <summary>
		/// 新增基金管理人
		/// </summary>
		/// <param name="investAdvisor"></param>
		public static void AddInvestAdvisor(InvestAdvisor investAdvisor)
		{
			InvestAdvisorData.Instance.AddInvestAdvisor(investAdvisor);
		}

		/// <summary>
		/// 修改基金管理人
		/// </summary>
		/// <param name="investAdvisor"></param>
		public static void UpdateInvestAdvisor(InvestAdvisor investAdvisor)
		{
			InvestAdvisorData.Instance.UpdateInvestAdvisor(investAdvisor);
		}

		/// <summary>
		/// 删除基金管理人
		/// </summary>
		/// <param name="id"></param>
		public static void DeleteInvestAdvisor(Guid id)
		{
			InvestAdvisorData.Instance.DeleteInvestAdvisor(id);
		}

		/// <summary>
		/// 获取基金管理人
		/// </summary>
		/// <param name="id"></param>
		/// <returns></returns>
		public static InvestAdvisor GetInvestAdvisor(Guid id)
		{
			return InvestAdvisorData.Instance.GetInvestAdvisor(id);
		}

		/// <summary>
		/// 获取基金管理人。
		/// </summary>
		/// <param name="pageIndex"></param>
		/// <param name="pageSize"></param>
		/// <returns></returns>
		public static IList<InvestAdvisor> GetInvestAdvisors(Int32 pageIndex, Int32 pageSize)
		{
			return InvestAdvisorData.Instance.GetInvestAdvisors(pageIndex, pageSize);
		}

		/// <summary>
		/// 获取所有基金管理人。
		/// </summary>
		/// <returns></returns>
		public static IList<InvestAdvisor> GetAllInvestAdvisors()
		{
			var result = InvestAdvisorData.Instance.GetInvestAdvisors(1, Int32.MaxValue);
			return result.OrderBy(p => p.Name).ToList();
		}
	}
}
